home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Online / MiamiSDK / doc / Miami.doc next >
Encoding:
Text File  |  1997-12-08  |  23.6 KB  |  875 lines

  1. TABLE OF CONTENTS
  2.  
  3. -- callback hook mechanism for packet monitoring --
  4. -- general information --
  5. -- information about T/TCP --
  6. freeaddrinfo
  7. gai_strerror
  8. getaddrinfo
  9. gethostbyname2
  10. getnameinfo
  11. if_freenameindex
  12. if_indextoname
  13. if_nametoindex
  14. if_nametoindex
  15. inet_aton
  16. inet_ntop
  17. inet_pton
  18. MiamiCloseSSL
  19. MiamiDisallowDNS
  20. MiamiGetHardwareLen
  21. MiamiGetPid
  22. MiamiGetResOptions
  23. MiamiIsOnline
  24. MiamiOnOffline
  25. MiamiOpenSSL
  26. MiamiPFAddHook
  27. MiamiPFRemoveHook
  28. MiamiSetResOptions
  29. MiamiSetSocksConn
  30. MiamiSupportsIPV6
  31. MiamiSysCtl
  32. sockatmark
  33. -- callback hook mechanism for packet monitoring --
  34.  
  35.     Miami 1.9.3 and higher support a simple packet monitoring mechanism.
  36.  
  37.     Miami allows you to add a callback hook that gets called whenever
  38.     Miami is about to send or receive a packet.  This allows you to
  39.     monitor any traffic between Miami and your network interface, to keep
  40.     statistics, and to detect attempts of unauthorized access.
  41.  
  42.     The two functions MiamiPFAddHook() and MiamiPFRemoveHook() are used
  43.     to install and remove a hook, respectively.
  44.  
  45. -- general information --                -- general information --
  46.  
  47.     miami.library contains some additional functions to augment
  48.     the API in bsdsocket.library.  The current version of miami.library
  49.     is 7 (for Miami 2.1).
  50.  
  51. -- information about T/TCP --            -- information about T/TCP --
  52.  
  53.     Miami 1.8.1 and higher support T/TCP (TCP for transactions).
  54.  
  55.     To use T/TCP in your programs you first need to check if Miami
  56.     version 1.8.1 is running (by checking if miami.library V3 or higher
  57.     exists).  Then use sendto() calls instead of connect() to establish a
  58.     connection.
  59.  
  60.     For more information please have a look at the example 'ttcptest.c'.
  61.  
  62. freeaddrinfo                             freeaddrinfo
  63.  
  64.    NAME
  65.     freeaddrinfo -- Free an addrinfo structure obtained earlier (V11)
  66.  
  67.    SYNOPSIS
  68.     freeaddrinfo( addrinfo );
  69.               A0
  70.  
  71.     void freeaddrinfo( struct addrinfo *addrinfo );
  72.  
  73.    FUNCTION
  74.     This function frees an address info structure (actually a linked list
  75.     of addrinfo structures) returned earlier by getaddrinfo().
  76.  
  77.    INPUTS
  78.     addrinfo - address info structure
  79.  
  80. gai_strerror                             gai_strerror
  81.  
  82.    NAME
  83.     gai_strerror -- Return the error text corresponding to an addressinfo
  84.     error code (V11)
  85.  
  86.    SYNOPSIS
  87.     str = gai_strerror( error );
  88.     D0            D0
  89.  
  90.     char *gai_strerror( long error );
  91.  
  92.    FUNCTION
  93.     This function returns the error string corresponding to an error
  94.     associated with getaddrinfo() or getnameinfo(), i.e.  one of the
  95.     EAI_...  codes.
  96.  
  97.     The error string returned is located in static storage and does not
  98.     need to be freed.
  99.  
  100.    INPUTS
  101.     error - error code
  102.  
  103.    RESULT
  104.     str (D0) - error string
  105.  
  106. getaddrinfo                              getaddrinfo
  107.  
  108.    NAME
  109.     getaddrinfo -- Look up IP addresses for a host name and service (V11)
  110.  
  111.    SYNOPSIS
  112.     error = getaddrinfo( hostname, servicename, hintsp, result );
  113.     D0             A0        A1        A2        A3
  114.  
  115.     long getaddrinfo( char *hostname, char *servicename, struct addrinfo
  116.         *hintsp, struct addrinfo **result );
  117.  
  118.    FUNCTION
  119.     This function performs a combined host name and service name lookup.
  120.     The result is stored in a linked list of "struct addrinfo".  The
  121.     pointer to the first structure in the list is stored in (*result).
  122.     After use the linked list needs to be freed by calling freeaddrinfo()
  123.     with the first element.
  124.  
  125.     If hintsp is not a NULL pointer then it needs to point to a struct
  126.     addrinfo that contains hints on how the returned result will be used
  127.     by the caller, i.e.  what kind of result the caller is interested in.
  128.     The caller can set ai_flags, ai_family, ai_socktype and ai_protocol.
  129.  
  130.     This function can be used with IPv4 and IPv6 addresses.
  131.  
  132.    INPUTS
  133.     hostname - host name
  134.  
  135.     servicename - service name
  136.  
  137.     hintsp - address hints
  138.  
  139.     result - pointer to return pointer
  140.  
  141.    RESULT
  142.     error (D0) - error code
  143.  
  144. gethostbyname2                               gethostbyname2
  145.  
  146.    NAME
  147.     gethostbyname2 -- Look up IP addresses for a host name (V11)
  148.  
  149.    SYNOPSIS
  150.     hostentry = gethostbyname2( name, family );
  151.     D0                A0      D0
  152.  
  153.     struct hostent *gethostbyname2( char *name, long family );
  154.  
  155.    FUNCTION
  156.     This function is identical to gethostbyname(), except that it accepts
  157.     an additional "address family" parameter, that allows the application
  158.     to indicate what kind of address records should be looked up through
  159.     DNS.  If AF_INET is specified then IPv4 addresses (A records) are
  160.     used.  If AF_INET6 is specified then IPv6 addresses (AAAA records)
  161.     are used.
  162.  
  163.     Please note that the format in which gethostbyname2() returns IP
  164.     addresses also depends on the setting of the RES_USE_INET6 resolver
  165.     option: if that option is set then gethostbyname2() always returns
  166.     IPv6 addresses.  Any IPv4 addresses found (A records) are
  167.     automatically converted into the corresponding IPv6 addresses
  168.     ("IPv4-mapped IPv6 addresses")
  169.  
  170.    INPUTS
  171.     name - host name
  172.  
  173.     family - address family
  174.  
  175.    RESULT
  176.     hostentry (D0) - host entry
  177.  
  178. getnameinfo                              getnameinfo
  179.  
  180.    NAME
  181.     getnameinfo -- Look up host name and service name (V11)
  182.  
  183.    SYNOPSIS
  184.     error = getnameinfo( sockaddr, addrlen, hostname, hostlen,
  185.     D0             A0        D0    A1      D1
  186.         servicename, servicelen, flags );
  187.         A2         D2         D3
  188.  
  189.     long getnameinfo( struct sockaddr *sockaddr, long addrlen, char
  190.         *hostname, long hostlen, char *servicename, long servicelen, long
  191.         flags );
  192.  
  193.    FUNCTION
  194.     This function looks up a host name and a service name corresponding
  195.     to the IP address and port number in the specified sockaddr
  196.     structure, and stores both names in the buffers provided by the
  197.     caller.
  198.  
  199.     flags can be a combination of the NI_...  flags specified in
  200.     <netdb.h>, to control the behavior of getnameinfo().
  201.  
  202.     This function can be used with IPv4 and IPv6 addresses.
  203.  
  204.    INPUTS
  205.     sockaddr - IP address and port
  206.  
  207.     addrlen - length of sockaddr
  208.  
  209.     hostname - buffer for host name
  210.  
  211.     hostlen - length of host name buffer
  212.  
  213.     servicename - buffer for service name
  214.  
  215.     servicelen - length of service name buffer
  216.  
  217.     flags - flags
  218.  
  219.    RESULT
  220.     error (D0) - error code
  221.  
  222. if_freenameindex                         if_freenameindex
  223.  
  224.    NAME
  225.     if_freenameindex -- Frees an array of interface index/name pairs
  226.     (V11)
  227.  
  228.    SYNOPSIS
  229.     if_freenameindex( nameindex );
  230.               D0
  231.  
  232.     void if_freenameindex( struct if_nameindex *nameindex );
  233.  
  234.    FUNCTION
  235.     This function frees an array of interface index/name pairs which was
  236.     previously obtained by calling if_nametoindex().
  237.  
  238.    INPUTS
  239.     nameindex - array of index/name pairs
  240.  
  241. if_indextoname                               if_indextoname
  242.  
  243.    NAME
  244.     if_indextoname -- Return the interface name corresponding to an
  245.     interface index (V11)
  246.  
  247.    SYNOPSIS
  248.     name = if_indextoname( index, name );
  249.     D0               D0     A0
  250.  
  251.     char *if_indextoname( long index, char *name );
  252.  
  253.    FUNCTION
  254.     This function stores the name of the interface corresponding to the
  255.     specified interface index in the specified buffer.  That buffer must
  256.     be at least IFNAMSIZ bytes in size.
  257.  
  258.     Upon success a pointer to the interface buffer is returned.  If an
  259.     error occurs (i.e.  if the interface index is invalid) then NULL is
  260.     returned.
  261.  
  262.    INPUTS
  263.     index - interface index
  264.  
  265.     name - buffer for interface name
  266.  
  267.    RESULT
  268.     name (D0) - interface name
  269.  
  270. if_nametoindex                               if_nametoindex
  271.  
  272.    NAME
  273.     if_nametoindex -- Return an array of interface index/name pairs (V11)
  274.  
  275.    SYNOPSIS
  276.     nameindex = if_nametoindex();
  277.     D0
  278.  
  279.     struct if_nameindex *if_nametoindex (void);
  280.  
  281.    FUNCTION
  282.     This function returns an array of interface index/name pairs,
  283.     describing all interfaces in the system.  The array is terminated by
  284.     a {0,NULL} entry.  After use the array has to be freed by calling
  285.     if_freenameindex().
  286.  
  287.    RESULT
  288.     nameindex (D0) - array of index/name pairs
  289.  
  290. if_nametoindex                               if_nametoindex
  291.  
  292.    NAME
  293.     if_nametoindex -- Return the interface index corresponding to an
  294.     interface name (V11)
  295.  
  296.    SYNOPSIS
  297.     index = if_nametoindex( name );
  298.     D0            A0
  299.  
  300.     long if_nametoindex( char *name );
  301.  
  302.    FUNCTION
  303.     This function returns the interface index (an integer >= 1)
  304.     corresponding to the specified interface name.    If the specified
  305.     interface name is invalid then 0 is returned.
  306.  
  307.    INPUTS
  308.     name - interface name
  309.  
  310.    RESULT
  311.     index (D0) - interface index
  312.  
  313. inet_aton                                inet_aton
  314.  
  315.    NAME
  316.     inet_aton -- Convert an IPv4 address from ASCII to numeric form (V11)
  317.  
  318.    SYNOPSIS
  319.     success = inet_aton( strptr, addrptr );
  320.     D0             A0      A1
  321.  
  322.     int inet_aton( char *strptr, void *addrptr );
  323.  
  324.    FUNCTION
  325.     This function is similar to inet_addr() in that it converts the ASCII
  326.     representation of an IPv4 address into the corresponding binary form.
  327.     However inet_addr() has one design flaw that is corrected by
  328.     inet_aton(): inet_addr() returns -1 if an error has occured, which is
  329.     identical to the binary representation of 255.255.255.255.  This
  330.     makes it impossible to parse 255.255.255.255 with inet_addr(),
  331.     because the return result would be indistinguishible from an error.
  332.     inet_aton() keeps the output buffer and return code separately,
  333.     making inet_aton() preferable over inet_addr() for new software.
  334.  
  335.     If no error occurs then inet_aton() stores the binary form of the
  336.     specified IP address in the output buffer, and returns 1.  Otherwise
  337.     0 is returned.
  338.  
  339.     Please note that inet_aton() only supports IPv4 addresses.  For IPv4-
  340.     and IPv6-compatible address conversion please use inet_pton().
  341.  
  342.    INPUTS
  343.     strptr - ASCII string
  344.  
  345.     addrptr - output buffer
  346.  
  347.    RESULT
  348.     success (D0) - success
  349.  
  350. inet_ntop                                inet_ntop
  351.  
  352.    NAME
  353.     inet_ntop -- Convert an IP address from numeric to ASCII form (V11)
  354.  
  355.    SYNOPSIS
  356.     strptr = inet_ntop( family, addrptr, strptr, len );
  357.     D0            D0        A0         A1      D1
  358.  
  359.     char *inet_ntop( long family, void *addrptr, char *strptr, long len
  360.         );
  361.  
  362.    FUNCTION
  363.     This function is similar to inet_ntoa() in that it converts the
  364.     binary representation of an IP address into a suitable ASCII
  365.     representation.  However inet_ntop() not only supports IPv4
  366.     addresses, but also IPv6 addresses (if the protocol stack supports
  367.     IPv6), making inet_ntop() preferable over inet_ntoa() for new
  368.     software.
  369.  
  370.     The parameter "family" can be AF_INET or AF_INET6, indicating an IPv4
  371.     or IPv6 address.
  372.  
  373.     If no error occurs then inet_ntop() stores the ASCII representation
  374.     of the specified IP address in the output buffer, and returns the
  375.     address of the output buffer.  Otherwise NULL is returned.
  376.  
  377.    INPUTS
  378.     family - address family
  379.  
  380.     addrptr - IP address
  381.  
  382.     strptr - output buffer
  383.  
  384.     len - length of output buffer
  385.  
  386.    RESULT
  387.     strptr (D0) - return buffer
  388.  
  389. inet_pton                                inet_pton
  390.  
  391.    NAME
  392.     inet_pton -- Convert an IP address from ASCII to numeric form (V11)
  393.  
  394.    SYNOPSIS
  395.     success = inet_pton( family, strptr, addrptr );
  396.     D0             D0      A0      A1
  397.  
  398.     int inet_pton( long family, char *strptr, void *addrptr );
  399.  
  400.    FUNCTION
  401.     This function is similar to inet_aton() and inet_addr() in that it
  402.     converts the ASCII representation of an IP address into the
  403.     corresponding binary form.  However inet_pton() not only supports
  404.     IPv4 addresses, but also IPv6 addresses (if the protocol stack
  405.     supports IPv6), making inet_pton() preferable over inet_aton() or
  406.     inet_addr() for new software.
  407.  
  408.     The parameter "family" can be AF_INET or AF_INET6, indicating an IPv4
  409.     or IPv6 address.
  410.  
  411.     If no error occurs then inet_pton() stores the binary form of the
  412.     specified IP address in the output buffer, and returns 1.  Otherwise
  413.     0 is returned.
  414.  
  415.    INPUTS
  416.     family - address family
  417.  
  418.     strptr - ASCII string
  419.  
  420.     addrptr - output buffer
  421.  
  422.    RESULT
  423.     success (D0) - success
  424.  
  425. MiamiCloseSSL                            MiamiCloseSSL
  426.  
  427.    NAME
  428.     MiamiCloseSSL -- closes the SSL library (V7)
  429.  
  430.    SYNOPSIS
  431.     MiamiCloseSSL();
  432.  
  433.  
  434.     void MiamiCloseSSL (void);
  435.  
  436.    FUNCTION
  437.     Closes the SSL library which was previously opened by a call to
  438.     MiamiOpenSSL.  You MAY NOT call CloseLibrary directly to close the
  439.     SSL library.
  440.  
  441. MiamiDisallowDNS                         MiamiDisallowDNS
  442.  
  443.    NAME
  444.     MiamiDisallowDNS -- disallow DNS lookups for gethostbyaddr.  (V3)
  445.  
  446.    SYNOPSIS
  447.     MiamiDisallowDNS( value );
  448.               D0
  449.  
  450.     void MiamiDisallowDNS( long value );
  451.  
  452.    FUNCTION
  453.     Prevents Miami from performing any external DNS lookups (i.e.  from
  454.     contacting DNS servers) for all subsequent calls to gethostbyaddr().
  455.     A 'value' of TRUE disallows DNS lookups, i.e.  prevents Miami from
  456.     doing DNS lookups.  A 'value' of FALSE reenables DNS lookups again.
  457.  
  458.     Calls to MiamiDisallowDNS do NOT nest, i.e.  if you call the function
  459.     multiple times with a 'value' of TRUE, then a single call with a
  460.     'value' of FALSE will reenable DNS lookups.
  461.  
  462.     While DNS lookups are deactivated gethostbyaddr() still returns
  463.     non-zero values for IP addresses which are either in the 'hosts'
  464.     database, or which are in Miami's DNS cache.
  465.  
  466.     MiamiDisallowDNS is primarily useful for diagnostic tools that know
  467.     an IP address and need to report this address to the user in a more
  468.     user-friendly way (i.e.  including the host name), but which would
  469.     rather report the IP address by itself than wait for a DNS lookup to
  470.     complete.  One such example is 'MiamiNetStat' with the '-N' flag set.
  471.  
  472.    INPUTS
  473.     value - boolean: disallow DNS lookups
  474.  
  475.    EXAMPLE
  476.     MiamiDisallowDNS(TRUE);
  477.  
  478. MiamiGetHardwareLen                      MiamiGetHardwareLen
  479.  
  480.    NAME
  481.     MiamiGetHardwareLen -- return the hardware address length.  (V5)
  482.  
  483.    SYNOPSIS
  484.     len = MiamiGetHardwareLen( name );
  485.     D0               A0
  486.  
  487.     int MiamiGetHardwareLen( char *name );
  488.  
  489.    FUNCTION
  490.     This function returns the length of the hardware address (Ethernet
  491.     address, Arcnet address etc.) for the specified interface in bytes.
  492.  
  493.    INPUTS
  494.     name - interface name
  495.  
  496.    RESULT
  497.     len (D0) - hardware address len
  498.  
  499. MiamiGetPid                              MiamiGetPid
  500.  
  501.    NAME
  502.     MiamiGetPid -- return Miami's internal process descriptor.  (V5)
  503.  
  504.    SYNOPSIS
  505.     pid = MiamiGetPid();
  506.     D0
  507.  
  508.     void *MiamiGetPid (void);
  509.  
  510.    FUNCTION
  511.     Miami associates an internal process descriptor which each opener.
  512.     Usually you should not care about this value, but there is one case
  513.     when it is useful to know what your process descriptor is:
  514.  
  515.     If your program manipulates routes directly (through routing
  516.     sockets), then the member "rtm_pid" of "struct rt_msghdr" contains
  517.     the process descriptor of the process that caused the routing
  518.     message.  You can compare this value against the value returned by
  519.     MiamiGetPid() to distinguish new (aynchronous) routing messages from
  520.     responses to your own routing messages.
  521.  
  522.    RESULT
  523.     pid (D0) - process descriptor
  524.  
  525. MiamiGetResOptions                       MiamiGetResOptions
  526.  
  527.    NAME
  528.     MiamiGetResOptions -- Return the current resolver options (V11)
  529.  
  530.    SYNOPSIS
  531.     options = MiamiGetResOptions();
  532.     D0
  533.  
  534.     long MiamiGetResOptions (void);
  535.  
  536.    FUNCTION
  537.     This function returns the current resolver options.  CAUTION: the
  538.     returned value may contain bits which are not listed in
  539.     <arpa/resolv.h>, i.e.  *undocumented* options.    Such options are off
  540.     limits to the caller: don't touch or change.
  541.  
  542.    RESULT
  543.     options (D0) - resolver options
  544.  
  545. MiamiIsOnline                            MiamiIsOnline
  546.  
  547.    NAME
  548.     MiamiIsOnline -- checks whether an interface is online (V10)
  549.  
  550.    SYNOPSIS
  551.     result = MiamiIsOnline( name );
  552.     D0            A0
  553.  
  554.     int MiamiIsOnline( char *name );
  555.  
  556.    FUNCTION
  557.     This function returns TRUE if the specified interface exists and is
  558.     online, FALSE otherwise.  Currently only interface names "lo0" and
  559.     "mi0" are valid.  This will change in Miami Deluxe though.
  560.  
  561.    INPUTS
  562.     name - interface name
  563.  
  564.    RESULT
  565.     result (D0) - result code
  566.  
  567. MiamiOnOffline                               MiamiOnOffline
  568.  
  569.    NAME
  570.     MiamiOnOffline -- checks whether an interface is online (V10)
  571.  
  572.    SYNOPSIS
  573.     MiamiOnOffline( name, online );
  574.             A0    D0
  575.  
  576.     void MiamiOnOffline( char *name, int online );
  577.  
  578.    FUNCTION
  579.     This function tells Miami to change the online state of the specified
  580.     interface.  Passing TRUE tells Miami to try and go online, passing
  581.     FALSE tells Miami to try and go online with the specified interface.
  582.     Currently only interface names "lo0" and "mi0" are valid.  This will
  583.     change in Miami Deluxe though.
  584.  
  585.     Please note that this function is asynchronous.  It returns
  586.     immediately, and does not wait for the online/offline process to
  587.     complete.
  588.  
  589.    INPUTS
  590.     name - interface name
  591.  
  592.     online - online status
  593.  
  594. MiamiOpenSSL                             MiamiOpenSSL
  595.  
  596.    NAME
  597.     MiamiOpenSSL -- opens the SSL library (V7)
  598.  
  599.    SYNOPSIS
  600.     ssllib = MiamiOpenSSL( taglist );
  601.     D0               A0
  602.  
  603.     struct Library *MiamiOpenSSL( struct TagItem *taglist );
  604.  
  605.    FUNCTION
  606.     This function attempts to open and initialize the SSL library for the
  607.     current caller.  A non-NULL return value indicates that the library
  608.     was successfully opened, and that the returned library base can be
  609.     used for MiamiSSL function calls.  A NULL return value indicates that
  610.     the SSL library could not be opened.
  611.  
  612.     You MAY NOT open the SSL library manually by calling OpenLibrary
  613.     directly.
  614.  
  615.     To close the SSL library call the function MiamiCloseSSL, NOT
  616.     CloseLibrary.
  617.  
  618.     No TagItems are currently defined, i.e.  you should pass a NULL
  619.     pointer or an empty TagList.
  620.  
  621.    INPUTS
  622.     taglist - list of TagItems
  623.  
  624.    RESULT
  625.     ssllib (D0) - SSL library base
  626.  
  627. MiamiPFAddHook                               MiamiPFAddHook
  628.  
  629.    NAME
  630.     MiamiPFAddHook -- add a packet monitoring hook.  (V5)
  631.  
  632.    SYNOPSIS
  633.     handle = MiamiPFAddHook( hook, interface, taglist );
  634.     D0             A0    A1      A2
  635.  
  636.     APTR MiamiPFAddHook( struct Hook *hook, UBYTE *interface, struct
  637.         TagItem *taglist );
  638.  
  639.    FUNCTION
  640.     This function adds a callback hook to monitor all traffic on the
  641.     specified interface.  'hook' has to be a pointer to an initialized
  642.     'struct Hook' defining the function that is called for each packet
  643.     sent or transmitted across the specified interface.  Each hook can
  644.     only be used for a single interface at a time, but you may add more
  645.     than one hook for each interface.
  646.  
  647.     'interface' is a pointer to an ASCIZ string that contains the name of
  648.     the interface to be monitored, currently either "mi0" or "lo0".
  649.  
  650.     'taglist' is a pointer to a list of TagItems.  Currently no TagItems
  651.     are supported, so you should pass NULL.
  652.  
  653.     'handle' is an opaque identifier that you need in order to remove
  654.     your hook later.  Do not make any assumptions about the meaning of
  655.     'handle'.  'handle' will be NULL if Miami was unable to add your
  656.     hook.
  657.  
  658.     Your hook is called with the following parameters:
  659.  
  660.     - A0: struct Hook *: your struct Hook
  661.  
  662.     - A1: struct MiamiPFBuffer *: a pointer to an initialized struct
  663.       MiamiPFBuffer describing the packet sent or received.
  664.  
  665.     - A2: APTR: your callback handle
  666.  
  667.    INPUTS
  668.     hook - callback hook
  669.  
  670.     interface - interface name to be monitored
  671.  
  672.     taglist - list of TagItems
  673.  
  674.    RESULT
  675.     handle (D0) - callback handle
  676.  
  677.    NOTE
  678.     You MAY NOT modify the contents of the buffer passed to you in the
  679.     hook.  Doing so may have unpredictable side effects including
  680.     crashes.
  681.  
  682.     You MUST remove each installed hook before closing miami.library.
  683.     This will NOT be done for you automatically.
  684.  
  685.     Your hook may be called on a task schedule other than your own task.
  686.     Be prepared for a small stack, for having just a task (not a
  687.     process), or for having an unusually low or high task priority.  Also
  688.     remember to properly set up the runtime environment required by your
  689.     compiler (e.g.    __saveds) and to switch off stack checking for the
  690.     hook function.
  691.  
  692.     From your hook you may NOT call any function that might directly or
  693.     indirectly get blocked within miami.library or bsdsocket.library,
  694.     i.e.  you may NOT call functions like WaitSelect(), send() etc.  from
  695.     your hook.  It is strongly recommended NOT to do any DOS I/O or
  696.     socket I/O at all from the hook.
  697.  
  698.     Packet monitoring can only be used with the registered version of
  699.     Miami.    In the unregistered version this function always returns
  700.     NULL.
  701.  
  702. MiamiPFRemoveHook                        MiamiPFRemoveHook
  703.  
  704.    NAME
  705.     MiamiPFRemoveHook -- remove a packet monitoring hook.  (V5)
  706.  
  707.    SYNOPSIS
  708.     MiamiPFRemoveHook( handle );
  709.                A0
  710.  
  711.     void MiamiPFRemoveHook( APTR handle );
  712.  
  713.    FUNCTION
  714.     This function removes a callback hook which was previously added by
  715.     calling MiamiPFAddHook.
  716.  
  717.     You MUST call MiamiPFRemoveHook exactly once for each hook added
  718.     earlier before closing miami.library.
  719.  
  720.    INPUTS
  721.     handle - callback handle
  722.  
  723. MiamiSetResOptions                       MiamiSetResOptions
  724.  
  725.    NAME
  726.     MiamiSetResOptions -- Sets the current resolver options (V11)
  727.  
  728.    SYNOPSIS
  729.     MiamiSetResOptions( options );
  730.                 D0
  731.  
  732.     void MiamiSetResOptions( long options );
  733.  
  734.    FUNCTION
  735.     This function sets the current resolver options.  CAUTION: The ONLY
  736.     approved use of this function is as follows: get the current resolver
  737.     options by calling MiamiGetResOptions(), change the state of some
  738.     bits, then call MiamiSetResOptions() with the new value.  NEVER
  739.     change bits that are not documented, and NEVER call
  740.     MiamiSetResOptions() without getting the current options first.
  741.  
  742.    INPUTS
  743.     options - resolver options
  744.  
  745. MiamiSetSocksConn                        MiamiSetSocksConn
  746.  
  747.    NAME
  748.     MiamiSetSocksConn -- set destination address for SOCKS.  (V10)
  749.  
  750.    SYNOPSIS
  751.     success = MiamiSetSocksConn( sa, len );
  752.     D0                 A0  D0
  753.  
  754.     int MiamiSetSocksConn( struct sockaddr *sa, int len );
  755.  
  756.    FUNCTION
  757.     This function sets the destination address for the next SOCKS bind()
  758.     request.  You only need to call this function if you want your
  759.     program to work with SOCKS, and your program accepts connections from
  760.     a machine without first establishing an outbound connection
  761.     (connect()) to that machine, from the same bsdsocket.library opener
  762.     process.  One example application is IRC-DCC.
  763.  
  764.     Pass the address of the target machine (the machine you are accepting
  765.     the connection from) and the address length.  The function returns
  766.     TRUE only if SOCKS is active and the function succeeded, FALSE in all
  767.     other cases (e.g.  if SOCKS was not used).
  768.  
  769.    INPUTS
  770.     sa - target address
  771.  
  772.     len - address length
  773.  
  774.    RESULT
  775.     success (D0) - success
  776.  
  777. MiamiSupportsIPV6                        MiamiSupportsIPV6
  778.  
  779.    NAME
  780.     MiamiSupportsIPV6 -- Check if IPv6 is supported (V11)
  781.  
  782.    SYNOPSIS
  783.     success = MiamiSupportsIPV6();
  784.     D0
  785.  
  786.     long MiamiSupportsIPV6 (void);
  787.  
  788.    FUNCTION
  789.     This function returns TRUE if IPv6 is supported by this protocol
  790.     stack, and FALSE otherwise.
  791.  
  792.    RESULT
  793.     success (D0) - success
  794.  
  795. MiamiSysCtl                              MiamiSysCtl
  796.  
  797.    NAME
  798.     MiamiSysCtl -- read or write system parameters (V3)
  799.  
  800.    SYNOPSIS
  801.     error = MiamiSysCtl( name, namelen, oldp, oldlenp, newp, newlen,
  802.     D0             A0    D0        A1      A2       A3     D1
  803.         len );
  804.         D0
  805.  
  806.     int MiamiSysCtl( long *name, unsigned long namelen, void *oldp, long
  807.         *oldlenp, void *newp, long newlen, int len );
  808.  
  809.    FUNCTION
  810.     This function allows the application to examine and change system
  811.     parameters, which are defined by their position in a system-wide
  812.     object tree.  The "name" parameter does not point to a character
  813.     string, but to an array of long definining the position of the object
  814.     within the object tree.
  815.  
  816.     For instance the object "net.inet.ip.forwarding" would be defined by
  817.     the name array {CTL_NET,AF_INET,IPPROTO_IP,IPCTL_FORWARDING}, with a
  818.     length of 4.
  819.  
  820.     To fetch a value, oldp points to a buffer into which Miami stores the
  821.     value.    oldlenp is a value-result argument: when the function is
  822.     called the value pointed to by oldlenp specifies the size of the
  823.     buffer, and on return the value contains the amount of data stored in
  824.     the buffer by Miami.  If the buffer is not large enough an error (-1)
  825.     is returned, with errno set to ENOMEM.
  826.  
  827.     As a special case, oldp can be a null pointer, and oldlenp a nonnull
  828.     pointer, and Miami determines how much data the call would have
  829.     returned, and returns this size through oldlenp.
  830.  
  831.     To set a new value, newp points to a buffer of size newlen.  If a new
  832.     value is not being specified, newp should be a null pointer, and
  833.     newlen should be 0.
  834.  
  835.    INPUTS
  836.     name - object name
  837.  
  838.     namelen - length of object name
  839.  
  840.     oldp - buffer for old value
  841.  
  842.     oldlenp - pointer to length of buffer for old value
  843.  
  844.     newp - buffer for new value
  845.  
  846.     newlen - length of buffer for new value
  847.  
  848.     len - address length
  849.  
  850.    RESULT
  851.     error (D0) - error code
  852.  
  853. sockatmark                               sockatmark
  854.  
  855.    NAME
  856.     sockatmark -- Check if socket is at an out-of-band mark (V11)
  857.  
  858.    SYNOPSIS
  859.     result = sockatmark( sockfd );
  860.     D0             D0
  861.  
  862.     long sockatmark( long sockfd );
  863.  
  864.    FUNCTION
  865.     This function checks if the receive stream of the specified socket is
  866.     currently at the out-of-band mark.  The function returns 1 in that
  867.     case, 0 otherwise.
  868.  
  869.    INPUTS
  870.     sockfd - socket descriptor
  871.  
  872.    RESULT
  873.     result (D0) - result code
  874.  
  875.